#include <bits/stdc++.h>
using namespace std;
int h[20005];
bool cmp(int x, int y){
    return x > y;
}
int main(){
    int n, b;
    cin >> n >> b;
    for (int i = 1; i <= n; i++){
        cin >> h[i];
    }
    sort(h + 1, h + n + 1, cmp);
    int s = 0;
    int c = 0;
    while (s < b){
        c++;
        s += h[c];
    }
    cout << c;
    return 0;
}